package com.example.diancai.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OssConfig {
    public static final String bucketName = "hq-store";
    public static final String objectName = "upload";
    public static final String bucketUrl = "https://hq-store.oss-cn-shanghai.aliyuncs.com";


    @Bean
    public OSS ossClient() {
        // Endpoint以杭州为例，其它Region请按实际情况填写。
        String endpoint = "http://oss-cn-shanghai.aliyuncs.com";
        String accessKeyId = "LTAI5tEcwfJJHYi63N7Zqmdm";
        String accessKeySecret = "rhYBVj6fpUwkWQCNkLgsxIgISHbATc";
        // 创建OSSClient实例。
        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }
}